« first day (39 days earlier)      last day (135 days later) » 

8:50 AM
@Οurous I'm not sure if the alternatives for and and or can be used to save bytes, because they are longer than import StdEnv. But anyway I think it is kind of fun to reimplement as much of StdEnv as possible with only the core language feaures.
Reminds me of this CnR answer in Haskell, where all the Prelude functions are inaccessible.
?[True:t]= ?t;?_=False always returns False, but %[a:r]|a= %r=a;%_=True works for the same byte count.
or can be shortened to %[a:r]|a=a= %r;%_=False
 
I suppose you could use them for values other than True or False, but yeah I missed that.
 
9:20 AM
inc can be %n#[_:x:_]=[n..] \n =x. Is there a way to replace the newline?
 
No, it needs to be a newline. And IIRC you need StdEnum for dotted expansions. And that first colon should be a comma for clarity.
Because the .. expressions are defined in terms of one, zero, +, -, and <
 
Ah, good to know.
Btw, you can add a feed from the tips question to this room.
 
 
2 hours later…
11:27 AM
@Laikoni I'll do that tomorrow, can't figure it out from mobile.
 
 
10 hours later…
9:07 PM
Οurous has made a change to the feeds posted into this room
 
I've added new posts from the Tips for golfing in Clean question to the feeds
 
9:19 PM
5
A: Tips for golfing in Clean

ΟurousKnow how to learn the language After all, how can anyone golf in a language they can't use! Online Clean isn't a well-known or well-documented language, and the name certainly doesn't make it easy to find much-needed resources to remedy these issues... or does it? Clean was originally called ...

4
A: Tips for golfing in Clean

ΟurousForget about character encoding Clean's compiler doesn't care about what encoding you think you've saved the source file as, just about the byte values in the file. This has some neat consequences. In the body of the source code, only bytes with code-points corresponding to the printable ASCII ...

3
A: Tips for golfing in Clean

ΟurousKnow your Knodes Some of the strongest constructs (for golfing) in functional languages are let ... in .... Clean of course, has this, and something better - the #. What is a node? Clean's #, and the ubiquitous | (pattern guard) are both known as 'node expressions'. They represent specific nod...

8
A: Tips for golfing in Clean

LaikoniAvoid import StdEnv when possible To access built-in functions, even seemingly basic ones like (==) or map, an import statement is needed, usually import StdEnv because it imports the most common modules like StdInt, StdBool and so on (see here for more info on StdEnv). However it can be possib...

1
A: Tips for golfing in Clean

ΟurousUse shorter lambdas Sometimes you find yourself using a lambda expression (to pass to map, or sortBy, etc.). When you're doing this (writing lambdas), there's the right... and the short way. The right way: This is sortBy, with an idiomatic lambda sorting lists from longest to shortest sortBy ...

 
9:34 PM
wew
Didn't know it'd do that
@Laikoni do you know of a shorter way to clear output than using StdIO with a GUI? I seem to remember finding something with System._Unsafe and using OS commands but I can't find it.
 
9:47 PM
@Οurous Better now than later when more answers might exist.
@Οurous I don't know more Clean than the two answers I have written so far and your tips, so I have no idea.
Though there are ascii control characters which might work.
 
Ah. So there are. I should refactor my other animation answer later as well then.
 
\b usually works as backspace, though for example not on TIO.
 

« first day (39 days earlier)      last day (135 days later) »