IRC channel logs

2020-04-09.log

back to list of logs

***karlosz_ is now known as karlosz
<daviid>manumanumanu: yes, please let us know when tou moved to sourcehut, bitbucket is a disaster
<daviid>fwiw, I am among those who would ask you to keep the license to gpl, quite more important then to be part of srfi
<RhodiumToad>manumanumanu: if you're going to use a lookup table, why not use a 256-entry one for byte->hex and save the bit masking?
<Aurora_iz_kosmos> https://paste.debian.net/hidden/3ec1a4d6/ I'm having some issues with setting up Guile+Geiser in Emacs
<Aurora_iz_kosmos>I get that error when I try to eval the buffer.
<Aurora_iz_kosmos>Okay. I found the problem. There's something broken in my distro if one has multiple versions of guile installed.
<Aurora_iz_kosmos>So, the error only happens when I have both Guile 2.0 & 2.2 installed, and when I use it from Geiser. (use-modules (ice-9 getopt-long)) (define (main args) 1) This works fine in the absolute-path invocation of either interpreter. However, when using Geiser, Guile-2.2 throws that error.
<Aurora_iz_kosmos>I have cross-posted this in #debian as I'm fairly sure it's packaging-related.
<str1ngs>Aurora_iz_kosmos: have you tried setting the emacs variable geiser-guile-binary to the version you want to use?
<Aurora_iz_kosmos>Yes, that's how I found the issue only occurs with guile-2.2
<RhodiumToad>perhaps the load path is being set incorrectly?
<Aurora_iz_kosmos>Currently going to be busy for the next while, but it occured to me that Debian's packaged Geiser might simply be too old.
<Aurora_iz_kosmos>I'll be testing that later.
***apteryx_ is now known as apteryx
<guix-vits>Hi Guile.
***rekado_ is now known as rekado
<manumanumanu>jcowan: please do. if you want me to give you anything more official than that, please send me an email at linus.bjornstam@fastmail.se
<manumanumanu>RhodiumToad: because I wrote that when I was 19 and was proud to get it to work, I suspect.
<jcowan>manumanumanu: I don't think anything else is necessary
<manumanumanu>RhodiumToad: I don't really understand what that would bring. Why use 256 element lookup table?
<RhodiumToad>why not?
<RhodiumToad>like I said, it saves on the bit-twiddling
<manumanumanu>oh, now I unedrstand
<jcowan>RhodiumToad, manumanumanu: I agree that would be better.
<RhodiumToad>hm, it's a pity there aren't any SIMD-style arithmetic ops on bytevectors
*jcowan remembers when you could have 128-word device drivers, which were position independent, or 256-word device drivers, which had to figure out where in memory they were loaded
*RhodiumToad found some vectorized hex->binary code he wrote a while back
<dsmith-work>{appropriate time} Greetings, Guilers
<civodul>hey hey!
<mwette>o/
<wingo>o/
<alextee[m]>is there a way to expose enums from C?
<dsmith-work>wingo: I tried changing the thumb->arm veneer code so it doesn't switch arm/thumb state. Got an Illegal instruction at the call site instead!
<lloda>wingo: civodul: ok to add #:declarative? #f to srfi-64? test-log-to-file is broken in 3.0 and this fixes it.
<lloda>I don't think it's worth patching upstream for this with any alternative solution like a box or w/e
<dsmith-work>It was an incorrect instrucion. Not sure why. The code that emit is is about 6 levels of nested routines. Ugh.
<dsmith-work>Havn'e been about to follow it.
<wingo>lloda: fine by me
<dsmith-work>Alternatively, building the whole system for thumb2 (instead of arm) has guile segfaulting about 50% of the time.
<wingo>dsmith-work: i wonder why it works on guix and qemu. do you have any idea/
<wingo>?
<lloda>done
<dsmith-work>wingo: Compiler and configured options maybe?
<wingo>sure. would be good to find out the difference tho
<civodul>lloda: sure, but do you know why it breaks? sounds fishy
<dsmith-work>wingo: Another wrinkle is that I'm cross compiling. I wouldn't think that should alter jit code generation though.
<dsmith-work>wingo: I'm amazed at how fast guile builds. Like 6 minutes! Using the bootstrapped .go files.
<Aurora_iz_kosmos>I confirm that using a recent (melpa-stable) Geiser version fixes the bytecode problem I previously reported. tl;dr Debian's geiser is outdated and broken.
<calculeris>Hello !
<calculeris>Im planning (very slowly but surely) to implement a 100% interpreted lisp.
<calculeris>[a slightly modified version of Kernel Programming Language].
<calculeris>I wish to implement it directly using a machine's instruction set.
<calculeris>At the moment, i don't know any instruction set.
<calculeris>The two options i currently hold are:
<calculeris>a) using x86_64 the same way picolisp does.
<calculeris>b) using guile's instruction set.
<calculeris>I like the option of using x86_64 because it would be fast enough and it will probably still holds for years to come. The problem would be that although it is staight forward to have native C runtime calls, using complex C libraries would be a titanium task because we would need to decode the C header.
<calculeris>This is my biggest issue, because i wish to do graphical tasks using my lisp, but the only way to do it would be by using some complex C API (i.e Vulkan) and making it more lispy to use.
<calculeris>This is where guile might be better. It would allow to leverage the work of the guile community, and thus use graphical lispy libraries and not the least, integrate well with guix.
<calculeris>But i am a bit affraid becuase it seems to be a bit too focused on compiled, semantically restricted scheme (recently i saw a post where they almost removed the ability to sort of eval in a distinct environment).
<calculeris>That is, it seems to be the total lisp opposite of the dialect i wish to implement [Highly interpreted with first class environment continuations and encapsulation type (a primitive tagging of data)].
<calculeris>So i'm asking the question :
<calculeris>ops, it seems i have overflood the chat limit, sending againt my post in pastbin
<calculeris>file:///home/sanqueg/Builds/discussion/asking.txt
<calculeris>long post : https://framabin.org/p/?c04935bcf396723b#mLjr0I/NQcfSaFqtKyLW/6KAgemmSJZHa4Qk89YOVHY= (couldn't use built-in pastbin)
<jcowan>calculeris: I recommend that you write your interpreter in Guile or any other Scheme, in which case you can do whatever you want. If it doesn't run fast enough in Guile 3.0, try a different Scheme. The more you stay with portable Scheme, the easier it will be.
<calculeris>but scheme is already too slow [[an implementation on top of scheme already exist, albeit not in guile]] that why i was thinking of the guile VM
<lloda>civodul: iiuc with the default declarative-modules? #t the compiler assumes module bindings are never modified
<lloda>but that's the very purpose of test-log-to-file
<lloda>with the default setting, the exported binding and the internal binding are not the same, so it's impossible to set it
<lloda>probably it's a bad interface, but...
<jcowan>calculeris: Which Scheme?
<calculeris>jcowan: MzScheme
<jcowan>That's pretty old; I don't even know if it has a JIT
<jcowan>what version?
<calculeris>jcowan: i don't know, but it was released in 2009 : https://web.cs.wpi.edu/~jshutt/kernel.html
<jcowan>Oh, yes
<marmulak>hey buddies
<marmulak>I am trying to rewrite one of my old programs in guile
<marmulak>just for fun
<marmulak>the purpose of the program is to find e-mail addresses in a string of text, and they are separated by commas normally, and likely a space
<marmulak>I have two version of the program, the original I wrote in C++ and it reads characters from standard input one by one and basically uses switches to determine when to discard data or print it out
<marmulak>this is very unsuitable for a funcational language I think, and I wrote a later version in haskell that reads the entire input into one giant string then splits it and then evaluates each element
<marmulak>so in guile I figured out basically how to use (read), but I noticed by default it reads a string until reaching whitespace
<marmulak>which is something I could work with but then I'd have to understand how to "loop" the process until all the strings are done and reaching the end of the input
<marmulak>other option is to try to mimic the haskell program's behavior and read until EOF, not stopping on whitespace
<calculeris>marmlak: you can also use (read-char), for a single char, at least in guile
<marmulak>I did see that
<marmulak>I thought doing the chars one by one as I had in C would just make the program harder to write in scheme
<calculeris>not any harder than the C version
<marmulak>apparently scheme does have while loops
<marmulak>calculeris: you may be right
<marmulak>with a while loop I'd check if there's any input left
<marmulak>ok I think I found a useful manual page
<dsmith-work>marmulak: (read) reads an s-expr. A "datum".
<manumanumanu>civodul: It breaks because to disable file output you have to set! the variable to #f which, if I understand correctly, does not work for declarative modules (due to inlining or the new "fixing" of bindings)
<marmulak>so far I have something like, (while (eof-object? x) (let...
<marmulak>but I can't seem to write a properly formed let expression lol
<marmulak>I wanted to let x be (read)
<manumanumanu>civodul: it was undocumented in srfi-64, but many people rely on it across many implementations.
<calculeris>marmulak: (let ( (x (read-char) ) ...)
<marmulak>the code I wrote might work with set!
<calculeris>marmulak: not if you use the let inside the while
<marmulak>I see
<marmulak>what confuses me about let is why there's two open parenthesis
<marmulak>I guess it's so you can have multiple lets
<dsmith-work>(let (things) body)
<calculeris>marmulak: because they group things by parenthesis, and not by bindings binders, (let ( (a 1) (b 2)) ... )
<dsmith-work>things is (name val) (name2 val2) ...
<marmulak>ah I get it, multiple definitions
<calculeris>marmulak: but there is no reasons you could not implement your own (my-let (name1 val1 name2 val2) ...)
<calculeris>marmulak: some lisp dialects have done this, like clojure or arc-lisp
<marmulak>I see
<dsmith-work>Another way to look at it: (let ((arg1 val1) (arg2 val2)) body) is pretty much identical to ((lambda (arg1 arg2) body) val1 val2)
<dsmith-work>That really helped me when I saw that anyway.
<marmulak>well I have to learn lambda first
<dsmith-work>OK. Save that for later then.
<dsmith-work>(define (name a1 a2) body) is same as (define name (lambda (a1 a2) body))
<Aurora_iz_kosmos>marmulak: There's the email-regex abomination...
<marmulak>hehe
<marmulak>ok this sort of works (while (not (eof-object? (peek-char)))...)
<marmulak>it's good progress, my program now works like cat
<marmulak>everything that goes in comes out if I do (display x) after (read)
<marmulak>although what's weird is when I read in whole strongs (display) actually prints #eof after the last one
<marmulak>strings*
<Aurora_iz_kosmos>I think `display' may be equivalent to `println'. You'd want to use write otherwise.
<dsmith-work>marmulak: It's possible to read the whole input at once too. I think it was somethine like read-delimited, and set the delimter to "".
<marmulak>ah hmm
<dsmith-work>That's where you are headed.
<marmulak>I tried write but I still get #<eof>, perhaps the loop is continuing too long
<marmulak>dsmith-work: yeah seems best that way
<dsmith-work>*Generally*, (display) is for humans to read, and (write) is for (read) to read.
<calculeris>Aurora_iz_kosmos: no, display is like printf, there is no newline at the end, (the prodcedure (newline) does add newline
<jcowan>calculeris: I think the first thing to try is to experiment with vau.rkt and to try to get SINK working on current Racket, which is much faster than MzScheme-2008
<Aurora_iz_kosmos>calculeris: Ah, my bad.
<jcowan>I just keep around a print function in my toolbox (display all arguments, then newline)
<marmulak>ok I see why it's printing #<eof>, the loop is iterating one too many times. Maybe the condition should be tested after rather than before
<calculeris>jcowan
<calculeris>jcowan: but the need is not so much as to get an interpreter working (there is already one done in C, fast enough), but to implement a language for the long run with full capabilities like debugger, world image, etc ..., and i doubt that using scheme will be good enough
<jcowan>It depends on the implementation. Racket is already like that.
<Aurora_iz_kosmos>How about SBCL?
<marmulak>also can someone tell me what exactly ice-9 is
<dsmith-work>sneek: ice-9?
<drakonis>the standard guile library, its a reference to a book
<sneek>Last time I checked ice-9 is "a nod to the fictional substance in Kurt Vonnegut's novel, Cat's Cradle, capable of acting as a seed crystal to crystallize the mass of software" <http://wingolog.org/archives/2009/01/07/a-brief-history-of-guile>
<Aurora_iz_kosmos>Ah... that's where the name came from, huh.
<calculeris>jcowan: truth be told, i allways had a disdain for Racket, personally i have considered it a betrayal of lisp, not in the language used, but by his community/philosophy, that why i haven't looked at it much, and im not sure i want to, i think i would be more disposed to go the rabbit hole with another lisp dialect
<dsmith-work>See, it was planned that guile would one day take over the world...
<drakonis>dsmith-work: like hurd?
<Aurora_iz_kosmos>heh
<calculeris>the worst april joke ever
<jcowan>Like Java. Or Cobol.
<drakonis>calculeris: ehhh, what
<calculeris>guix's april joke
<Aurora_iz_kosmos>Well, iirc Guile only runs on POSIX platforms, no?
<marmulak>yeah I thought it was a substance that causes water to instantly turn into ice
<calculeris>telling it was working ...
<jcowan>Aurora_iz_kosmos: No, also Windows
<drakonis>that's a ehhh what regarding racket
<drakonis>guile only runs on hurd and linux
<marmulak>does guile implicitly include the standard library?
<Aurora_iz_kosmos>jcowan: Oh. Is that a recent change or am I just that out of the loop?
<drakonis>calculeris: what's the issue with racket?
<drakonis>btw, the april fools joke is only half a joke
<drakonis>they got it to work on hurd but they arent dropping linux
<jcowan>Aurora_iz_kosmos: Windows has never been an official target
<calculeris>drakonis: just a gut feeling about all the unlispiness i feel by the community, that is reinforced by the rumors of a racket with another non-nestable syntaxe
<drakonis>ah yes, hearsay
<drakonis>how about looking into it instead of disliking it?
<calculeris>drakonis: because there are others lisp still avalibles, so that i prefer to first go by the lisp inspiring me more confidance
<calculeris>drakonis: but maybe it the wrong move
<drakonis>it is perhaps the wrong move to do that
<drakonis>because racket is very good
<manumanumanu>jcowan: I put the hex.scm here: https://hg.sr.ht/~bjoli/misc/browse/default/hex.scm I am not in a jurisdiction which has public domain, so I couldn't be assed to do the research. You may use it as you please without giving credit if that is your thing :D If I have some time over I might try to make a faster version with a full lookup table for bin->hex. I'll drop you a message if I make any changes
<Aurora_iz_kosmos>jcowan: I see. Makes it hard to eat the world when it isn't on most user-devices.
*Aurora_iz_kosmos would like to see a userspace Linux dominance but isn't expecting it
<calculeris>drakonis: yeah,maybe another factor that i have against racket, is that it is used to implement others languages, while i wish to do the same from my other dialect of lisp, and thus would feel very defeated if i had to learn all the racket way of processing languages just to get my lisp done
<jcowan>manumanumanu: All you have to do is say it's okay to change the license and I'll substitute the MIT license, which is what SRFIs use
<drakonis>okay i dont see what's wrong with that
<jcowan>calculeris: Racket's multiple languages work by compiling them into the racket/base language, which is then compiled into bytecode (or into Chez on the new system).
<jcowan>You probably don't want to do that.
<calculeris>drakonis: the fear that my lisp will be prisioner of Racket ecosystem, and also the fear that i know very few real lisp implementations done in Racket
<calculeris>yeah, obviusly racket is a better choice than C, but still, im afraid
<drakonis>nobody's forcing you to use racket though?
<drakonis>there's still various lisp implementations being written
<Aurora_iz_kosmos>The only way to avoid such dependencies would be to use no implementation extensions in whatever Scheme or Lisp you use. Or alternatively to use compatibility libraries for portability (often seen in CL)
<calculeris>i really found the dialect of lisp in witch i want to dedicate at least a decade, so the choice i will make is preatty chanllengin (and of course no one is forcing me to do it in racket, but it would be fool to not be influenced by people and make a bigger mistake alone ...)
<jcowan>I'm just saying that of living Lisps probably Racket has the best programming environment, so since you want that, you should probably try to inherit it.
<jcowan>Because you aren't compiling to Racket, you won't get all the advantages, but you'll get many.
<jcowan>Or if you want to implement debugger, image dump and restore, etc. yourself,
<jcowan>you should probably go with sbcl or chez to maximize performance.
<jcowan>without sacrificing too much ease of development, as using C or C++ would.
<calculeris>Common lisp is an option that i have not explored only because i don't like the default lisp starting point (which will change the day i start using Next browser), but intuitivly i would more gladly go the common lisp route.
<calculeris>Are you saying that common lisp has a better environmennt than racket ?
<calculeris>And the whole compiling or not compiling, i don't get it, my lisp dialect won't be compilling, but for my implementation i don't mind compilling, why does it affect the way i can access raket facilities ?
<calculeris>i sry, i misread, you are only telling that common lisp or chez are more efficient
<calculeris>*ah
<calculeris>but my doubt about obtaining the whole racket environment remains, why would i not be able to get it if my PL is not compiled ?
<calculeris>And it is this crazy to try to implement the whole facility of environment from the ground ?
<Aurora_iz_kosm[21:41:55]<calculeris> because it has first class continuation
<marmulak>hey what is char_pred
<calculeris>are these 3 things already a lot of work for a single person ?
<calculeris>becasue in my mind, the big task was to interface the datum from my lisp to a graphical editor (which is obvously a very big task, after all t would be an emacs like editor but for graphics instead of text)
<mwette>we may all be running on ARM laptops and desktops in five years
<Aurora_iz_kosmos>calculeris: Depends on what's your opinion about implementing a parser without parser-generators.
<calculeris>its lisp, not so hard, no ?
<spk121>marmulak: usually it is a procedure that takes a single character and returns #t or #f
<calculeris>by the way, i have no idea what is a parser-generator
<spk121>marmulak: in what context?
<dsmith-work>marmulak: Probably some predictate for characters.
<marmulak>I'm trying to invoke string-delete but it's not happy
<ahungry>I think "a lot" is relative. I think its a lot less work than implementing a web browser from scratch that supports css3 / es2017, but its "a lot" more work than making a web app in a weekend
<marmulak>I thought I could just do (string-delete " " s) to strip out spaces
<calculeris>ahungry: sure but my point is that there is no leverage for the graphical editor, which is the big task, but for the little task like world image, it doesn't matter rly if i use or not a leverage, right ?
<dsmith-work>marmulak: try (help string-delete)
<marmulak>k
<spk121>marmulak: (string-delete #\space s)
<spk121>marmulak: or (string-delete char-whitespace? s)
<marmulak>oh that's neat
<marmulak>can I provide multiple things to delete
<spk121>marmulak: sure (string-delete (lambda (x) (or (char=? #\a) (char=? #\b))) "hello world")
<marmulak>shit, lambda
<dsmith-work>Lambda is the Ultiamte!
<marmulak>dafuq are these lambdas doing in my code
<calculeris>mind you, i prefer vau-calculis
<spk121>marmulak: to avoid lambda, perhaps (string-delete (string->char-set "abc") "hello world")
<dsmith-work>marmulak: Get used to them, it's lambdas all the way down.
<calculeris>dsmith-work: never !, i prefer fexpr all the way down, thus no longer need of macros
<dsmith-work>Wooo. Illegal instruction building on rp3 buster!
<marmulak>tryin the lambda actually didn't seem to work for me
<marmulak>char-set did
<marmulak>this makes it look close to the haskell version of this program
<rekado>if you don’t like to see “lambda” you can use srfi-26’s cut and cute.
<spk121>yeah, i messed the lambda. it should have been (lambda (x) (or (char=? x #\a) (char=? x #\b)))
<marmulak>what is cut and cute
<dsmith-work>Haskell has lambdas.
<marmulak>spk121: thanks
<marmulak>dsmith-work: it's probably the part of haskell I didn't understand
<dsmith-work>They are just spelled funny
<rekado>\x -> x
<rekado>that’s a lambda in Haskell (the identity function)
<rekado>marmulak: https://srfi.schemers.org/srfi-26/srfi-26.html
<Aurora_iz_kosmos>calculeris: https://en.wikipedia.org/wiki/Parser_generator
<dsmith-work>A lambda is an expression that evaluates to code. The code has no name, but you can bind it to a name, pass it as a value, or call it directly.
<Aurora_iz_kosmos>(define (sum x y) (+ x y) => (define sum (lambda (x y) (+ x y)))
<dsmith-work>Yep. Same thing. Just some sugar
<mwette>calculeris: in guile (system base lalr) (ice-9 peg) are parser generators
<dsmith-work>marmulak: Sometimes you don't really need to name your funtions.
<dsmith-work>Something you will see often is called a "
<dsmith-work>"thunk".
<calculeris>Aurora_iz_kosmos: mwette: i have some troubles understanding what is this, it is just a parser that convert to a datum tree ?, which in lisp world would be called a reader ?
<dsmith-work>(lambda () some-code-here)
<Aurora_iz_kosmos>calculeris: Essentially, you define the tokens & lexical units your language would have, and it autogenerates the code to do the analysis for you.
<Aurora_iz_kosmos>So lexing and tokenizing is done.
<calculeris>Aurora_iz_kosmos: i think i don't need to do that in the dialect of lisp i wish to implement, my dialect of lisp store either a symbol or a datum, if we need to know the value of a symbol, we eval the symbol in the environment-object/datum
<calculeris>Aurora_iz_kosmos: thus a symbol is only a symbol, and hold no extra information
<Aurora_iz_kosmos>Maybe, I don't know how you've set it up, you may very well already have done those steps anyway.
<calculeris>Aurora_iz_kosmos: No i still haven't done anything, but they seemed only useful for languages that don't work with datum/ mix of symbols and objects
<Aurora_iz_kosmos> https://github.com/hylang/hy/blob/master/hy/lex/lexer.py This Lispy Python wrapper uses one called rply. (https://rply.readthedocs.io/en/latest/)
<calculeris>Aurora_iz_kosmos: yeah, you are right, i need a lexer (called a reader in lisp) so that the lexical token (a sequence of chars) is converted to a datum in lisp , what i don't need is the parser which add semantic, because by using directly the datum, i have already all the semntical meaning i need to eval
<Aurora_iz_kosmos>Ah, I see.
<marmulak>writing code in scheme is fun but I feel like learning to write efficient or optimized code in scheme is going be a much greater endeavor
<marmulak>I have to learn all these complicated concepts
<Aurora_iz_kosmos>So, for an ugly thing to say that nevertheless is true: Maximal optimization will require a lot of non-idiomatic mutation-oriented code.
<marmulak>yea
<marmulak>not that I'm performance focused, it's more a matter of, as a programmer being able to write code that makes me feel "I wrote this well" as opposed to "I wrote this so poorly, but amazingly it works"
<Aurora_iz_kosmos>Ah, that's a rather different thing.
<marmulak>I actually did finish the program I wrote earlier
<marmulak>*was trying to write
<jcowan>"Premature optimization is the root of all evil."
<marmulak>couldn't have done it without your guys' help
<Aurora_iz_kosmos>I find that most Scheme code I write isn't performance-dependent nearly so much as to make optimization worth it.
<marmulak>looking at the end result, the way I solved the problem in scheme is functionally very close to how I solved it in C++, just with many fewer lines of code thanks to higher level functions
<Aurora_iz_kosmos>Mostly because I tend to use Scheme for scripting.
<marmulak>that's nice
<marmulak>I might end up using it for that as well
<Aurora_iz_kosmos>Some things don't port as well as I'd want, such as replacing some Python scripts I had that used libraries (which I then have to find C alternatives for and wrap in Guile).
<marmulak>the haskell version feels different and also looks prettier (less messy), but it was much harder to write and doesn't have any loop. Both the C and Scheme version have a loop and I guess that makes it feel procedural
<Aurora_iz_kosmos>Hm, wouldn't Haskell & Scheme both use recursion?
<marmulak>for this particular problem the solution wasn't terribly recursive
<Aurora_iz_kosmos>Ah I see.
<marmulak>let me look at them again to see the difference
<marmulak>the input data is like an e-mail header, with text like: Billy Bob <bb@bb.com>, "Joe" <joe@bob.com>, "abc@abc.com" <abc@abc.com>
<marmulak>the C program reads characters individually into a string until it reaches something invalid and then decides that to do with what it's gathered so far, if it had an @ in it and didn't fall betwene quotes, it goes to output